ALMaSS  1.0
The Animal, Landscape and Man Simulation System
CurveClasses.h
Go to the documentation of this file.
1 //
2 //CurveClasses.h
3 //
4 /*
5 *******************************************************************************************************
6 Copyright (c) 2014, Christopher John Topping, University of Aarhus
7 All rights reserved.
8 
9 Redistribution and use in source and binary forms, with or without modification, are permitted provided
10 that the following conditions are met:
11 
12 Redistributions of source code must retain the above copyright notice, this list of conditions and the
13 following disclaimer.
14 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
15 the following disclaimer in the documentation and/or other materials provided with the distribution.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
18 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
20 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 ********************************************************************************************************
26 */
27 
28 #ifndef CurveClasses_H
29 #define CurveClasses_H
30 
31 using namespace std;
32 
37 {
38 public:
39  CurveClass(bool a_reversecurve, double a_MaxX,double a_MinX, const char* a_name);
40  virtual ~CurveClass();
41  virtual double GetY(double a_X);
42  virtual void WriteDataFile( int a_step );
43 protected:
49  double m_step;
51  double m_step_inv;
53  double* m_values;
55  //double m_scaler;
57  string m_name;
60 
62  virtual void CalculateCurveValues();
64  virtual double DoCalc(double /* a_x */) { return 0; }
65 
66 };
67 
68 
71 {
72 public:
73  GompertzCurveClass(double a_A, double a_B, double a_C, bool a_reversecurve, double a_MaxX, double a_MinX, const char* a_name);
74  virtual ~GompertzCurveClass();
75 protected:
78  double m_parameterA;
80  double m_parameterB;
82  double m_parameterC;
83 
85  virtual double DoCalc(double a_x);
86 };
87 
90 {
91 public:
92  Polynomial2CurveClass(double a_A, double a_B, double a_C, double a_D, bool a_reversecurve, double a_MaxX, double a_MinX, const char* a_name);
93  virtual ~Polynomial2CurveClass();
94 protected:
100  double m_parameterA;
102  double m_parameterB;
104  double m_parameterC;
106  double m_parameterD;
107 
109  virtual double DoCalc(double a_x);
110 };
111 
114 {
115 public:
116  ThresholdCurveClass(double a_A, double a_B, double a_C, double a_D, bool a_reversecurve, double a_MaxX, double a_MinX, const char* a_name);
117  virtual ~ThresholdCurveClass();
118 protected:
124  double m_parameterA;
126  double m_parameterB;
128  double m_parameterC;
130  double m_parameterD;
131 
133  virtual double DoCalc(double a_x);
134 };
137 public:
138  HollingsDiscCurveClass( double a_A, double a_B, bool a_reversecurve, double a_MaxX, double a_MinX, const char* a_name );
139  virtual ~HollingsDiscCurveClass();
140 protected:
143  double m_parameterA;
145  double m_parameterB;
147  virtual double DoCalc( double a_x );
148 };
152 public:
153  PettiforFeedingTimeCurveClass(double a_A, double a_B, double a_C, bool a_reversecurve, double a_MaxX, double a_MinX, const char* a_name);
155 protected:
157  double m_parameterA;
159  double m_parameterB;
161  double m_parameterC;
163  virtual double DoCalc(double a_x);
164 };
165 
166 #endif
Provides a flexible curve class which provides a quick way to calculate return values for any given x...
Definition: CurveClasses.h:37
double m_parameterMaxX
A parameter for a the maximum value of X we consider.
Definition: CurveClasses.h:45
string m_name
A scaler for the x-values.
Definition: CurveClasses.h:57
double * m_values
The values of y we store for each X.
Definition: CurveClasses.h:53
bool m_reversecurve
If true the values fall from 1 to zero, otherwise its zero to 1.
Definition: CurveClasses.h:59
virtual double DoCalc(double)
The specific calulation of y for a given x.
Definition: CurveClasses.h:64
double m_parameterMinX
A parameter for a the minimum value of X we consider.
Definition: CurveClasses.h:47
double m_step_inv
The inverse of m_step.
Definition: CurveClasses.h:51
double m_step
The size of each step on the X-axis.
Definition: CurveClasses.h:49
A Gompertz curve class.
Definition: CurveClasses.h:71
double m_parameterC
Parameter C.
Definition: CurveClasses.h:82
double m_parameterB
Parameter B.
Definition: CurveClasses.h:80
double m_parameterA
Parameter A.
Definition: CurveClasses.h:78
A Hollings Disc curve class - type II functional response.
Definition: CurveClasses.h:136
double m_parameterB
Parameter B.
Definition: CurveClasses.h:145
double m_parameterA
Parameter A.
Definition: CurveClasses.h:143
A curve for feeding time derived from Pettifor et al (2000). Journal of Applied Ecology 37: 103-135.
Definition: CurveClasses.h:151
double m_parameterC
Parameter C is the threshold floksize above which feeding time remains at maximum.
Definition: CurveClasses.h:161
double m_parameterA
Parameter A is the maximum feeding time.
Definition: CurveClasses.h:157
double m_parameterB
Parameter B is the minimum feeding time.
Definition: CurveClasses.h:159
A polynomial curve class.
Definition: CurveClasses.h:90
double m_parameterC
Parameter C.
Definition: CurveClasses.h:104
double m_parameterA
Parameter A.
Definition: CurveClasses.h:100
double m_parameterB
Parameter B.
Definition: CurveClasses.h:102
double m_parameterD
Parameter D.
Definition: CurveClasses.h:106
A rectangular threshold curve class.
Definition: CurveClasses.h:114
double m_parameterA
Parameter A is the return if between xmin & xmax.
Definition: CurveClasses.h:124
double m_parameterD
Parameter D is the xmax.
Definition: CurveClasses.h:130
double m_parameterC
Parameter C is xmin.
Definition: CurveClasses.h:128
double m_parameterB
Parameter B is the return if not between xmin & xmax.
Definition: CurveClasses.h:126